package com.zimmor.ftp;

import cn.hutool.core.io.FileUtil;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.lang.Console;
import cn.hutool.extra.ftp.Ftp;
import org.apache.commons.net.ftp.FTPFile;

import java.util.List;

/**
 * @Author:zimmor
 * @Date: 2021/10/11 1:06
 * @Description
 * @version: 1.0.0
 */

public class FtpDemo {
    public static void main(String[] args) {
//        Ftp ftp = new Ftp("ftp.sjtu.edu.cn");
//        ftp.init();
//        List<FTPFile> ftpFiles = ftp.lsFiles("ftp.sjtu.edu.cn/logs/rsync/", null);
//        for (FTPFile ftpFile : ftpFiles) {
//            System.out.println("ftpFile.toString() = " + ftpFile.toString());
//        }
        Ftp ftp = new Ftp("http://ftp.sunet.se/");

        List<String> ls = ftp.ls("/about");
        Console.log(ls);

//        boolean upload = ftp.upload("/file/aaa", FileUtil.file("E:/qrcodeWithLogo.jpg"));
//        Console.log(upload);

        IoUtil.close(ftp);

    }
}
